<template>
  <el-select placeholder="请选择运维人员" clearable v-model="customer">
    <el-option
      v-for="user in userList"
      :key="user.userId"
      :label="user.nickName"
      :value="user.userId"
    ></el-option>
  </el-select>
</template>
<script>
import { mapGetters } from "vuex";
export default {
  props: ["value", "size"],
  data() {
    return {};
  },
  computed: {
    ...mapGetters(["userList"]),
    customer: {
      get() {
        return  typeof this.value == "string" ? this.value : this.value.operationId;
      },
      set(v) {
        if (typeof this.value == "string") {
          this.$emit("input", v);
        } else {
          const userName = this.userList.find(item => item.userId == v).nickName
          this.$emit("input", {
            operationId: v,
            operationName: userName
          });
        }
      },
    },
  },
  created() {},
  methods: {},
};
</script>
